package menu;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window;
import java.io.IOException;

import javax.swing.JFrame;

public class MainGameScreen extends JFrame{
	private static final long serialVersionUID = 1L;
	private PanelMain menuPanel;
	
	public MainGameScreen() throws IOException{  
		this.setTitle("TRACE-ON");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setUndecorated(false);
		
		setWindowSize(this, 600, 400, false);
		centerFrame(this);
		
		menuPanel = new PanelMain(this);
		menuPanel.setVisible(true);
		menuPanel.setLocation(0, 0);
		this.add(menuPanel);
		
		menuPanel.setPreferredSize(new Dimension(this.getWidth(), this.getHeight()));
		this.setVisible(true);
		
		//Window win = new Window(this);
		//win.setVisible(true);
	}
	
	public static void main(String[] args) throws IOException {
		MainGameScreen app = new MainGameScreen();
		app.setVisible(true);
	}
	
	public static void centerFrame(Window frame) {
        Dimension frameSize = frame.getSize();
        frame.setSize(frameSize);
        frame.setLocation(
            (Toolkit.getDefaultToolkit().getScreenSize().width
                - frameSize.width) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height
                - frameSize.height) / 2);
    }
	
	public static void setWindowSize(Window frame, int width, int height, boolean fullScreen)
	{
		if (fullScreen)
		{
			int screenX = Toolkit.getDefaultToolkit().getScreenSize().width;
			int screenY = Toolkit.getDefaultToolkit().getScreenSize().height;
			
			frame.setSize(screenX, screenY);
		}
		else
		{
			frame.setSize(width, height);
		}
	}
}
